import { Component } from 'react'
import Taro from '@tarojs/taro'
import {RichText, View, Text, WebView} from '@tarojs/components'
import './index.scss'
import global from '../../global';


export default class Index extends Component {

  constructor(props) {
    super(props);
  }

  componentWillMount () {}

  componentDidMount () {}

  componentWillUnmount () {}

  componentDidShow () {}

  componentDidHide () { }

  render () {
    let newsInfo = global.newsInfo;
    newsInfo.content = `<div class="ql-editor">${newsInfo.content}</div>`
    return (
      <View>
        <View className='new_attach_info'>
          <Text className='attach_name'>{newsInfo.author}</Text>
          <Text className='attach_time'>{newsInfo.time}</Text>
        </View>
        <View className='news_container'>
          <RichText className='rich_content' type='text' nodes={newsInfo.content.replace(/\<img/g, '<img style="max-width:100%;height:auto"')
            .replace(/em;/g,'rpx;')
            .replace(/<section/g, '<div').replace(/\/section>/g, '/div>')
            .replaceAll('/dev-api/', 'http://192.168.1.102:8080/')} >
          </RichText>
        </View>
      </View>
    )
  }
}
